/*
 * 文件名：SUserService.java
 * 版权：Copyright by hlst
 * 描述：
 * 修改人：liuziyu
 * 修改时间：2016年7月18日
 * 跟踪单号：
 * 修改单号：
 * 修改内容：
 */

package com.zcsy.manage.shop.service.system.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zcsy.manage.model.base.ShopIdAndShopName;
import com.zcsy.manage.model.system.User;
import com.zcsy.manage.persistence.base.ShopInfoDao;
import com.zcsy.manage.persistence.shop.ShopAccountDao;
import com.zcsy.manage.persistence.system.UserDao;
import com.zcsy.manage.shop.service.system.ISUserService;

@Service
public class SUserServiceImpl implements ISUserService {

	@Autowired
	UserDao userDao;
	
	@Autowired
	ShopAccountDao shopAccountDao;
	
	@Autowired
	ShopInfoDao shopInfoDao;
	
	@Override
	public User shopKeeperLogin(String loginName){
		return userDao.shopKeeperLogin(loginName);
	}
	
	@Override
	public List<String> getShopIdsByUserId(String userId){
		return shopAccountDao.getShopIdsByUserId(userId);
	}
	
	@Override
	public List<ShopIdAndShopName> getShopInfosByUserId(String userId){
		return shopInfoDao.getShopInfosByUserId(userId);
	}
	
	@Override
	public int forgetPass(String pwd, String loginname) {
		return userDao.forgetPass(pwd, loginname);
	}
	
	@Override
	public int changePwd(User user) {
	    return userDao.changePwd(user);
	}
	
	@Override
    public List<User> selectUserIfPhoneExists(String phone, int type) {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("phone", phone);
        map.put("type", type);
        return userDao.selectUserIfPhoneExists(map);
    }
	
	@Override
    public int boundPhone(String phone, String loginname) {
        return userDao.boundPhone(phone, loginname);
    }
}
